package com.jida.tijian.controller;

import com.jida.tijian.dto.OrderListRequestDto;
import com.jida.tijian.dto.ResponseObject;
import com.jida.tijian.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrdersController {
    @Autowired
    OrdersService ordersService;


    @RequestMapping("/ordersList")
    public ResponseObject ordersList(@RequestBody OrderListRequestDto orderListRequestDto){
        ResponseObject responseObject = ordersService.ordersList(orderListRequestDto);
        //System.out.println(responseObject.getDesc()+",,,,"+responseObject.getStatus()+",,,,");
        return ordersService.ordersList(orderListRequestDto);
    }
    /**
     * 思路：controller->service->mapper->sql
     * 需要分页插件(mybatis提供)
     *
     *
     * 医生端查询订单列表
     * 请求对象应该怎样定义
     * userId realName sex smId orderDate state pageNumber pageSize(10)
     *
     * 响应对象应该怎么定义
     * ResponseObject T
     * T?
     * Class(o.orderId,u.userId,u.realName,u.sex,s.smId,s.name,h.name)
     * 还有分页数据  总记录数  总页数  当前第几页
     *
     * SELECT o.orderId,u.userId,u.realName,u.sex,s.smId,s.name,h.name
     * FROM orders o,users u,setmeal s,hospital h
     * WHERE o.userId = u.userId
     * AND o.smId = s.smId
     * AND o.hpId = h.hpId
     * AND u.sex = 0
     * AND o.state = 1
     * ORDER BY o.orderDate
     */
}
